﻿CREATE PROCEDURE [dbo].[AddPersonRoleAccess]
	@PersonRoleAccessId uniqueidentifier,
	@Person uniqueidentifier,
	@SecurityRole uniqueidentifier,
    @Permissions int,
	@CreatedBy uniqueidentifier,
	@CreatedOn datetime,
    @LastChanged datetime,
	@LastChangedBy uniqueidentifier,

	@TimeStamp timestamp output

AS

	INSERT INTO PersonRoleAccess

	(PersonRoleAccessId, Person, SecurityRole, [Permissions], CreatedBy, CreatedOn, LastChanged, LastChangedBy)

	VALUES 

	(@PersonRoleAccessId, @Person, @SecurityRole, @Permissions, @CreatedBy, @CreatedOn, @LastChanged, @LastChangedBy)

	SELECT @TimeStamp = [TimeStamp]

	FROM PersonRoleAccess WHERE PersonRoleAccessId = @PersonRoleAccessId

RETURN 0